//
//  DYCleanView.m
//  PrivatePhoto
//
//  Created by PrivatePhoto Team on 2021.
//  Copyright © 2021年 PrivatePhoto Team. All rights reserved.
//

#import "DYCleanView.h"

@interface DYCleanView ()

@property (nonatomic, strong) UIImageView *logonIcon;
@property (nonatomic, strong) UILabel *titleLabel;

@end

@implementation DYCleanView

- (instancetype)initWithFrame:(CGRect)frame{
    if (self == [super initWithFrame:frame]) {
        [self configSubView];
        self.userInteractionEnabled = YES;
        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(viewDidClick:)];
        [self addGestureRecognizer:tap];
    }
    return self;
}

- (void)configSubView{
    self.backgroundColor = [UIColor colorWithHexString:@"#5C92FF"];
    [self addSubview:self.logonIcon];
    [self.logonIcon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(25);
        make.centerY.mas_offset(0);
    }];
    [self addSubview:self.titleLabel];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.mas_offset(0);
    }];
}

- (void)viewDidClick:(UITapGestureRecognizer *)sender{
    !self.cleanBtnBlock ?: self.cleanBtnBlock();
}

#pragma mark --- setter/getter

- (void)setName:(NSString *)name{
    _name = name;
    self.titleLabel.text = name;
}

- (UIImageView *)logonIcon{
    if (!_logonIcon) {
        _logonIcon = [[UIImageView alloc] init];
        _logonIcon.image = [UIImage imageNamed:@"qs"];
    }
    return _logonIcon;
}

- (UILabel *)titleLabel{
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc] init];
        _titleLabel.font = [UIFont systemFontOfSize:21 weight:3];
        _titleLabel.textColor = [UIColor whiteColor];
        _titleLabel.textAlignment = NSTextAlignmentCenter;
        _titleLabel.text = @"删除所选";
    }
    return _titleLabel;
}



@end
